﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Business.Compta
{
    public class ComptaConsommation
    {
        private int id;
        private string type, _type;
        private double prix, _prix;
        private double volume, _volume;
        private DateTime date,_date;

        public int Id
        {
            get
            {
                return id;
            }
            set
            {
                id = value;
            }
        }
        
        public string Type
        {
            get
            {
                return type;
            }
            set
            {
                type = value;
            }
        }
        
        public double Volume
        {
            get
            {
                return volume;
            }
            set
            {
                volume = value;
            }
        }
        
        public double Prix
        {
            get
            {
                return prix;
            }
            set
            {
                prix = value;
            }
        }

        public DateTime Date
        {
            get
            {
                return date;
            }
            set
            {
                date = value;
            }
        }

        public ComptaConsommation()
        {
            this.id = -1;
            this.type = null;
            this.date = DateTime.Parse(DateTime.Now.ToShortDateString());
            this.volume = 0.0;
            this.prix = 0.0;

        }

        public ComptaConsommation(int _id,
            string _type,
            double _volume,
            double _prix,
            DateTime _date)
        {
            this.id = _id;
            this.type = _type;
            this.date = _date;
            this.volume = _volume;
            this.prix = _prix;

            this._type = this.type;
            this._prix = this.prix;
            this._volume = this.volume;
            this._date = this.date;
        }

        public virtual void commit()
        {
            this._type = this.type;
            this._prix = this.prix;
            this._volume = this.volume;
            this._date = this.date;
        }

        public virtual void reject()
        {
            this.type = this._type;
            this.prix = this._prix;
            this.volume = this._volume;
            this.date = this._date;
        }
    }
}
